﻿using Grpc.Net.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WeChatV3Pay.Application.Transactions.Dtos.JsApi;
using WeChatV3Pay.Core.Enums;

namespace WeChatV3Pay.UnitTest.Grpc客户端测试
{
    public class 交易测试
    {
        private readonly WeChatPay.WeChatPayClient _client;

        public 交易测试(WeChatPay.WeChatPayClient client)
        {
            _client = client;
        }

        [Fact]
        public async Task 根据系统生成的订单号查询订单测试()
        {
            var num = await _client.QueryTransactionsByIdAsync(new QueryTransactionRequest()
            {
                MchId = "123456789",
                SearchKey = Guid.NewGuid().ToString().Replace("-", ""),
                PrivateKey = "1231245555",
                SerialNo = "123456789"
            });
            Assert.NotNull(num);
        }

        [Fact]
        public async Task 根据商户系统内部订单号查询订单测试()
        {
            var num = await _client.QueryTransactionsByOutTradeNOAsync(new QueryTransactionRequest()
            {
                MchId = "123123123",
                SearchKey = "123456",
                PrivateKey = "123123123",
                SerialNo = "43C2629A724963ACFE44148D0BEEA095E30EADD6"
            });
            Assert.NotNull(num);
        }
    }
}
